package sk.tuke.magsa.personalistika.ui;

import sk.tuke.magsa.framework.ui.TableDialog;
import sk.tuke.magsa.personalistika.Application;
import sk.tuke.magsa.personalistika.entity.Zamestnanec;

public class ZamestnanecTable extends TableDialog<Zamestnanec> {
    public ZamestnanecTable() {
        super(Application.getInstance().getZamestnanecDao());
    }

    protected ZamestnanecForm createFormDialogForInsert() {
        return new ZamestnanecForm();
    }

    protected ZamestnanecForm createFormDialogForEdit(Zamestnanec entity) {
        return new ZamestnanecForm(entity);
    }

    protected void printHeader() {
        System.out.print(String.format("|%5s", "ID"));
        System.out.print(String.format("|%10s", "Meno"));
        System.out.print(String.format("|%10s", "Priezvisko"));
        System.out.print(String.format("|%10s", "Vek"));
        System.out.print(String.format("|%10s", "Oddelenie"));
        System.out.println();
    }

    protected void printRow(Zamestnanec entity) {
        System.out.print(String.format("|%5d", entity.getIdent()));
        System.out.print(String.format("|%10s", entity.getMeno()));
        System.out.print(String.format("|%10s", entity.getPriezvisko()));
        System.out.print(String.format("|%10s", entity.getVek()));
        System.out.print(String.format("|%10s", Application.getInstance().getOddelenieDao().find(entity.getOddelenie()).getNazov()));
        System.out.println();
    }

    protected void printNumberPropertiesMenu() {
        System.out.println("Select property you want to search by");
        System.out.println("(0) Meno");        
        System.out.println("(1) Priezvisko");        
        System.out.println("(2) Vek");        
        System.out.println("(3) Oddelenie");        
        System.out.println("Enter selection: ");
    }
}